package dao;

import domain.User;
import org.springframework.orm.hibernate3.HibernateTemplate;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: mikhail.krupitskiy
 * Date: 26.10.2010
 * Time: 14:46:53
 * To change this template use File | Settings | File Templates.
 */
public class UserDAO implements IUserDAO {

    private HibernateTemplate hibTempl;

    public void setHibernateTemplate(HibernateTemplate hibTempl) {
        this.hibTempl = hibTempl;
    }

    public void addUser(String name, String password) {
        User user = new User();
        user.setName(name);        
        hibTempl.save(user);
    }

    public List<User> getAll() {
        return hibTempl.loadAll(User.class);
    }
}
